#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMediaPlayer>
#include <QVideoProbe>
#include <QAudioProbe>
#include <QWidget>
#include "playlistmodel.h"

class MainWindow: public QWidget
{
    Q_OBJECT
public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    Q_INVOKABLE QString getPlayerUrl() const;
    void setModel(PlayListModel *playListModel);
    void setPlayer(QMediaPlayer *player);
    void addToPlaylist(const QList<QUrl> urls);
signals:
    void messageChanged(QString message);
    void durationInfoChanged(QString tStr);
public slots:
    void open();
    void metaDataChanged();
    void statusChanged(QMediaPlayer::MediaStatus status);
    void bufferingProgress(int progress);
    void displayErrorMessage();
private:
    void setTrackInfo(const QString &info);
    void setStatusInfo(const QString &info);
    void handleCursor(QMediaPlayer::MediaStatus status);

    QString trackInfo;
    QString statusInfo;
    QMediaPlayer *m_player;
    PlayListModel *m_model;
};
#endif // MAINWINDOW_H
